Jump to content

Talk:Empty string

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Untitled

[edit]

This could benefit from attention by an expert in theoretical computer science. Since I'm not even close to that, I'll just make it a bit more readable. Charlie.liban (talk) 17:50, 12 February 2008 (UTC)[reply]

Added a bit explaining the difference between null and "", though I couldn't find a concise way of explaining the difference. Modifications welcome! And I'm supposed to be a computer scientist ... 199.43.13.100 (talk) 14:20, 3 July 2008 (UTC)[reply]

Empty strings exist as an additive identity element, both in formal language theory (at least the theory that I took!) and in programming languages. They're just another string, but they happen to have interesting properties - much like 0 for algebra. I guess the confusion comes from the empty part: empty sets (which might be referred to as null sets) have zero elements; empty strings (confusingly called null strings) have zero symbols. On top of this, there are a whole slew of slightly different concepts related to null.
charlie liban (talk) 20:05, 8 July 2008 (UTC)[reply]

Empty String v Language

[edit]

Hi, at the moment the empty language page redirects to this empty string page. This page correctly notes that they should not be confused (!), if somebody with more wikipedia knowledge than me could create the page for 'Empty language' and create a stub for it, that would be great! — Preceding unsigned comment added by 118.93.63.129 (talk) 03:13, 7 April 2012 (UTC)[reply]

 Fixed [1] [2]. Incnis Mrsi (talk) 08:48, 7 April 2012 (UTC)[reply]

Vacuous truth

[edit]
This page is not a forum for general discussion of the topic of the article; you might try the reference desk instead. JBL (talk) 22:20, 21 January 2024 (UTC)[reply]
The following discussion has been closed. Please do not modify it.

Is it like the empty set, in that every statement about it is true (including the negation of every statement)? For example, is it alphanumeric, is it not, or is it both (or perhaps neither)? TheGoatOfSparta (talk) 14:52, 21 January 2024 (UTC)[reply]

Yes, vacuous truth applies to the empty string (it applies to anything that contains nothing), but the description you gave is not exactly what vacuous truth means. That sounds more like the principle of explosion, which is that any statement can be considered true given false assumptions, or in other words, that anything can be proven based on a contradiction. There is nothing contradictory about an empty string,[a] so there are true statements and false statements about empty strings. An example of a statement that is obviously false, is that it contains 'x' – it doesn't contain anything by definition.
Vacuous truth comes in when we're making a statement about all elements of the empty string. Because of De Morgan's laws, we know that such statements are exactly the same as saying there there does not exist a counterexample – and the empty string does not contain anything, so it's true. So, the statements "all characters are 'x'" and "all characters are not 'x'" are both true, because they're both "it does not contain something". The empty string is alphanumeric, because a string being alphanumeric is defined as all characters in the string being letters or numbers. However, it is false to say that it's not alphanumeric, because then we're no longer saying "all" so "there does not exist", we're saying "not all" so "does exist", which is always false for the empty string. I hope that is clear.
I just added a mention of this in the 'Formal theory' section :) ―Jochem van Hees (talk) 15:38, 21 January 2024 (UTC)[reply]
According to your logic, the statement "all characters of the empty string are not alphanumerics" is true, because there is no counterexample: the empty string does not contain an alphanumeric. Therefore, the string is not alphanumeric and it is also alphanumeric. TheGoatOfSparta (talk) 19:21, 21 January 2024 (UTC)[reply]
From the Wikipedia page "empty set":
For any property P:
For every element of the empty set, the property holds.
There is no element of the empty set for which the property holds.
Therefore, all characters of the empty string are alphanumerics and none of them is an alphanumeric. So the empty string is not alphanumeric and alphanumeric. TheGoatOfSparta (talk) 19:31, 21 January 2024 (UTC)[reply]
There is a subtle but important difference between these statements:
  1. "all characters of the empty string are not alphanumeric" – true
  2. "not all characters of the empty string are alphanumeric" – false
Statement #2 is what is meant with saying that a string is "not alphanumeric".
The difference is maybe more obvious when considering a non-empty string, for example "a$b". Here, statement #1 is false because 'a' and 'b' are both counterexamples. Statement #2 is true, because it's simply the negation of "all characters of the empty string are alphanumeric", which is false because '$' is a counterexample. ―Jochem van Hees (talk) 20:33, 21 January 2024 (UTC)[reply]
I agree, but the empty string is both alphanumeric and not alphanumeric. That all of its characters are not alfanumeric is sufficient for the string to be not alphanumeric. TheGoatOfSparta (talk) 20:37, 21 January 2024 (UTC)[reply]
No, that is only true of strings that have characters. --JBL (talk) 22:20, 21 January 2024 (UTC)[reply]

Notes

  1. ^ Nothing contradictory that we know of, anyway. We can't be certain because of Gödel's second incompleteness theorem.

The redirect '' has been listed at redirects for discussion to determine whether its use and function meets the redirect guidelines. Readers of this page are welcome to comment on this redirect at Wikipedia:Redirects for discussion/Log/2024 March 27 §  until a consensus is reached. Steel1943 (talk) 19:18, 27 March 2024 (UTC)[reply]